/*
 * @authors :Bin Mei
 * @date    :2017-08-07
 * @description：票交汇PC站 - enterprise 企业换票、购票
 */
import Auth from 'src/utils/requireAuth';

module.exports = {
	path: 'draft',
	childRoutes: [
    {
      path: 'detail',//详情
      getComponent(location, cb) {
        require.ensure([], (require) => {
          cb(null, require('./Details'));
        });
      },
      onEnter: (nextState, replace) =>{
        let {query} = nextState.location;
        let draftType = query&&query.draftType;
        Auth(nextState, replace,{ title:`${draftType==2?'换':'购'}票详情`}) 
      }  
    },
    {
      path: 'apply',//详情
      getComponent(location, cb) {
        require.ensure([], (require) => {
          cb(null, require('./Apply'));
        });
      },
      onEnter: (nextState, replace) =>  Auth(nextState, replace,{ title:'提交意向'}) 
    }
    
	],
  indexRoute: {
    getComponent(location, cb) {
      require.ensure([], (require) => {
        cb(null, require('./Index'));
      });
    },
    onEnter: (nextState, replace) =>{
      let {query} = nextState.location;
      let draftType = query&&query.draftType;
      Auth(nextState, replace,{ title:`企业${draftType==2?'换':'购'}票`,type:'HOME'} ) 
    }
  }
}